
class Employee(object):

    def __init__(self,name,age,gender,mobile_number,is_leave=0):
        self.name=name
        self.age=age
        self.gender=gender
        self.mobile_number=mobile_number
        self.is_leave= False if is_leave == 0 else True

    def __str__(self):
        msg = '离职' if self.is_leave else '在职'
        return f'{self.name}\t{self.age}\t{self.gender}\t{self.mobile_number}\t{msg}'


if __name__ == '__main__': # 如果当前py文件就是执行的入口，未来测试自定义模块的方式。
    emp = Employee('张三',23,'男','1234567')
    print(emp)
    print(emp.__dict__) # python对象转换成字典
    print(vars(emp)) # python对象转换成字典